package zhaoyong.wang.tlias.service.impl;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import zhaoyong.wang.tlias.mapper.DeptMapper;
import zhaoyong.wang.tlias.pojo.Dept;

import java.time.LocalDateTime;
import java.util.List;
@Service
public class DeptServicelmpl  implements DeptService{
    @Autowired
    private DeptMapper deptMapper;
    @Override
    public List<Dept> list() {
        return deptMapper.list();
    }

    @Override
    public void delete(Integer id) {
        deptMapper.deleteById(id);
    }

    @Override
    public void update(Dept deptname) {
        deptname.setCreateTime(LocalDateTime.now());
        deptname.setUpdateTime(LocalDateTime.now());
        deptMapper.update(deptname);
    }

    @Override
    public Dept select(Integer id) {

        return  deptMapper.selcetById(id);
    }

    @Override
    public void gengxin(Dept dept) {
        dept.setUpdateTime(LocalDateTime.now());
        deptMapper.gengxin(dept);
    }
}
